radio | NN 2 IE 3 DOM 1 | ||||
The radio object is a form control generated with an INPUT element whose TYPE attribute is set to "radio". radio objects related to each other are assigned the same name. This means all like-named radio objects become a collection of radio objects. It may be necessary, therefore, to reference an individual radio button as an item in an array. The entire array, of course, has a length property you can use to assist in looping through all radio objects within the group, if necessary: var radioGrp = document.forms[0].myRadio for (var i = 0; i < radioGrp.length; i++) { alert("The value of button index " + i + " is " + radioGrp [i].value) } Properties and methods listed as follows are for individual radio buttons. | |||||
HTML Equivalent<INPUT TYPE="radio"> | |||||
Object Model Reference
|
accessKey | NN n/a IE 4 DOM 1 | ||
Read/Write | |||
A single character key that "clicks" on the radio button.
The browser and operating system determine whether the user must
press a modifier key (e.g., | |||
Exampledocument.entryForm.myRadio[0].accessKey = "n" | |||
Value Single alphanumeric (and punctuation) keyboard character. | |||
|
checked | NN 2 IE 3 DOM 1 | ||
Read/Write | |||
Whether the radio button is selected or turned on by the user. To find out whether the form element is set to be highlighted when the page loads, see the defaultChecked property. | |||
Exampleif (document.choiceForm.myRadio[0].checked) { } | |||
Value Boolean: true | false. | |||
|
dataFld | NN n/a IE 4 DOM n/a | ||
Read/Write | |||
Used with IE 4 data binding to associate a remote data source column name to a radio button element attribute determined by properties set in the object. A DATASRC attribute must also be set for the element. Setting both the dataFld and dataSrc properties to empty strings breaks the binding between element and data source. | |||
Exampledocument.myForm.myRadio[0].dataFld = "linkURL" | |||
Value Case-sensitive identifier of the data source column. | |||
|
dataSrc | NN n/a IE 4 DOM n/a | ||
Read/Write | |||
Used with IE 4 data binding to specify the name of the remote ODBC data source (such as an Oracle or SQL Server database) to be associated with the element. Content from the data source is specified via the DATAFLD attribute. Setting both the dataFld and dataSrc properties to empty strings breaks the binding between element and data source. | |||
Exampledocument.myForm.myRadio[0].dataSrc = "#DBSRC3" | |||
Value Case-sensitive identifier of the data source. | |||
|
defaultChecked | NN 2 IE 3 DOM 1 | ||
Read/Write | |||
Whether element has the CHECKED attribute set in the tag. You can compare the current checked property against defaultChecked to see whether the state of the control has changed since the document loaded. Changing this property doesn't affect the current checked status. | |||
Examplevar rBut = document.forms[0].myRadio[0] if (rBut.checked != rBut.defaultChecked) { } | |||
Value Boolean value: true | false. | |||
|
disabled | NN n/a IE 4 DOM 1 | ||
Read/Write | |||
Whether the element is available for user interaction. When set to true, the element cannot receive focus or be modified by the user. It is also not submitted with the form. | |||
Exampledocument.forms[0].myRadio[0].disabled = true | |||
Value Boolean value: true | false. | |||
|
form | NN 2 IE 3 DOM n/a | ||
Read-only | |||
Returns a reference to the FORM element that contains the current element (if any). This property is most often passed as a parameter for an event handler, using the this keyword to refer to the current form control. | |||
Example<INPUT TYPE="button" VALUE="Validate Form" onClick="doValidate(this.form)"> | |||
Value Object reference. | |||
|
name | NN 2 IE 3 DOM 1 | ||
Read/Write | |||
The identifier associated with the form control. The value of this property is submitted as one-half of the name/value pair when the form is submitted to the server (the value property of the highlighted radio button supplies the value portion). Names are hidden from user view, since control labels are assigned via other means, depending on the control type. Form control names may also be used by script references to the objects. Assign the same name to every radio button in a group whose highlight/unhighlight characteristics are related. | |||
Exampledocument.orderForm.myRadio[0].name = "Win32" | |||
Value Case-sensitive identifier that follows the rules of identifier naming: it may contain no whitespace, can't begin with a numeral, and should avoid punctuation except for the underscore character. | |||
|
recordNumber | NN n/a IE 4 DOM n/a | ||
Read-only | |||
Used with data binding, returns an integer representing the record within the data set that generated the element (i.e., an element whose content is filled via data binding). Values of this property can be used to extract a specific record from an Active Data Objects (ADO) record set (see recordset property). | |||
Example<SCRIPT FOR="tableTemplate" EVENT="onclick"> myDataCollection.recordset.absoluteposition = this.recordNumber ... </SCRIPT> | |||
Value Integer. | |||
|
status | NN n/a IE 4 DOM n/a | ||
Read/Write | |||
Whether the element is highlighted/checked. This property is identical to the value property. | |||
Exampleif (document.forms[0].myRadio[0].status) { ... } | |||
Value Boolean value: true | false. | |||
|
tabIndex | NN n/a IE 4 DOM 1 | ||
Read/Write | |||
A number that indicates the sequence of this element within the tabbing order of all focusable elements in the document. Tabbing order follows a strict set of rules. Elements that have values other than zero assigned to their tabIndex properties are first in line when a user starts tabbing in a page. Focus starts with the element with the lowest tabIndex value and proceeds in order to the highest value, regardless of physical location on the page or in the document. If two elements have the same tabIndex values, the element that comes earlier in the document receives focus first. Next come all elements that either don't support the tabIndex property or have the value set to zero. These elements receive focus in the order in which they appear in the document. A value of -1 removes the element from tabbing order altogether. Note that the Macintosh user interface doesn't provide for giving focus to elements other than text and password INPUT fields. | |||
Exampledocument.forms[0].myRadio[0].tabIndex = 6 | |||
Value Integer. | |||
|
type | NN 3 IE 4 DOM 1 | ||
Read-only | |||
Returns the type of form control element. The value is returned in all lowercase letters. It may be necessary to cycle through all form elements in search of specific types to do some processing on (e.g., emptying all form controls of type "text" while leaving other controls untouched). | |||
Exampleif (document.forms[0].elements[3].type == "radio") { ... } | |||
Value Any of the following constants (as a string): button | checkbox | file | hidden | image | password | radio | reset | select-multiple | select-one | submit | text | textarea. | |||
|
value | NN 2 IE 3 DOM 1 | ||
Read/Write | |||
Current value associated with the form control that is submitted with the name/value pair for the group of like-named elements. All values are strings, but they may represent other kinds of data, including Boolean and numeric values. | |||
Exampledocument.forms[0].myRadio[0].value = "*" | |||
Value String. | |||
|
blur( ) | NN n/a IE 4 DOM n/a |
Removes focus from the current element and fires an onBlur event (in IE). No other element necessarily receives focus as a result. | |
Returned Value None. | |
Parameters None. |
focus( ) | NN n/a IE 4 DOM n/a |
Gives focus to the current element and fires the onFocus event (in IE). If another element had focus at the time, it receives an onBlur event. | |
Returned Value None. | |
Parameters None. |
handleEvent( ) | NN 4 IE n/a DOM n/a | ||
handleEvent(event) Instructs the object to accept and process the event whose specifications are passed as the parameter to the method. The object must have an event handler for the event type to process the event. | |||
Returned Value None. | |||
Parameters
|